package com.ecjtu.stadiumre_servations.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ecjtu.stadiumre_servations.entity.domain.GroupActivity;
import com.ecjtu.stadiumre_servations.entity.dto.GroupActivityDTO;
import com.ecjtu.stadiumre_servations.entity.dto.GroupActivityQueryDTO;
import com.ecjtu.stadiumre_servations.response.Result;
import com.ecjtu.stadiumre_servations.service.GroupActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/groupActivity")
public class GroupActivityController {
    @Autowired
    private GroupActivityService groupActivityService;
    @PutMapping("/createGroupActivity")
    public Result createGroupActivity(@RequestParam String userId,@RequestBody GroupActivityDTO groupActivityDTO){
        return groupActivityService.createGroupActivity(userId,groupActivityDTO);
    }
//    @PutMapping("/createGroupActivity2")
//    public Result createGroupActivity2(@RequestParam String userId, @RequestBody GroupActivityDTO groupActivityDTO){
//        return groupActivityService.createGroupActivity2(userId,groupActivityDTO);
//    }
    @DeleteMapping("/deleteGroupActivity/{activityId}")
    public Result deleteGroupActivity(@PathVariable String activityId){
        return groupActivityService.deleteGroupActivity(activityId);
    }
    @PostMapping("/updateGroupActivity")
    public Result updateGroupActivity(@RequestBody GroupActivity groupActivity){
        return groupActivityService.updateGroupActivity(groupActivity);
    }
    @GetMapping("/listGroupActivities")
    public Result listGroupActivities(Page<GroupActivity> page,  GroupActivityQueryDTO query){
        return groupActivityService.listGroupActivities(page, query);
    }
    @GetMapping("/listGroupActivitiesByVenueId")
    public Result listGroupActivitiesByVenueId(Page<GroupActivity> page, @RequestParam String venueId){
        return groupActivityService.listGroupActivitiesByVenueId(page, venueId);
    }
    @GetMapping("/getGroupActivityById/{activityId}")
    public Result getGroupActivityById(@PathVariable String activityId){
        return groupActivityService.getGroupActivityById(activityId);
    }

    @GetMapping("/getGroupActivityByActivityId")
    public Result getGroupActivityByActivityId(Page<GroupActivity>page,@RequestParam String activityId){
        return groupActivityService.getGroupActivityByActivityId(page,activityId);
    }
    @GetMapping("/getGroupActivityByUserId/{userId}")
    public Result getGroupActivityByUserId(@PathVariable  String userId){
        return groupActivityService.getGroupActivityByUserId(userId);
    }
}
